package com.woniuxy.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.commons.utile.Result;
import com.woniuxy.controller.dto.RepairLogDto;
import com.woniuxy.controller.form.ShowrepairForm;
import com.woniuxy.controller.form.UpdateRepairInfoForm;
import com.woniuxy.dao.model.RepairLog;
import com.woniuxy.service.RepairLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 维修日志表 前端控制器
 * </p>
 *
 * @author Keep it simple
 * @since 2022-06-28
 */
@RestController
@Api(tags = "维修日志")
public class RepairLogController {

    @Resource
    RepairLogService repairLogService;

//    @ApiOperation("根据维修单id查询对应日志")
//    @GetMapping("/getRepairLogById")
//    public Result getRepairLogById(Integer id){
//        List<RepairLog> repairLogs = repairLogService.list(new QueryWrapper<RepairLog>()
//                .eq("repairNum", id));
//        return Result.instance().setData(repairLogs);
//    }

    @ApiOperation("根据维修单id查询对应日志")
    @PostMapping("/getrepairlog")
    @ResponseBody
    public Result getrepairlogbyNum(@Valid @RequestBody ShowrepairForm showrepairForm){
        List<RepairLogDto> repairLogDtos = repairLogService.get(showrepairForm.getRepairNum());
        return Result.instance().setCode(200).setMessage("成功").setData(repairLogDtos);
    }



}

